package com.spider.moudle.util;

import com.spider.moudle.factory.ExecutorServiceFactoy;
import com.spider.moudle.factory.NamedThreadFactory;

import java.util.concurrent.*;

/**
 * @author 夏茂轩
 * @package com.spider.silence.utils
 * @Date 2017/1/11 15:09
 */
public class CenterExecutorUtil {


    private static ExecutorService pool = ExecutorServiceFactoy.buildExecutorService(Integer.valueOf(PropertiesUtil.getVal("main.woker.size")),
            "主线程池", new NamedThreadFactory("主线程池", "主线程池"));
    /**
     * @author 夏茂轩
     * @date 2017/1/11 15:13
     * @description 添加线程到线程池中
     * @param runnable
     */
    public synchronized static void execute(Runnable runnable){
        pool.execute(runnable);
    }
}
